import * as Cesium from "cesium";
const click = (viewer: Cesium.Viewer): void => {
  const handle = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
  handle.setInputAction((e) => {
    const cartesian3 = viewer.scene.pickPosition(e.position);
    const cartographic =
      viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian3);
      let string = Cesium.Math.toDegrees(cartographic.longitude).toString() +
      ","+
      Cesium.Math.toDegrees(cartographic.latitude).toString()+
      "," +
      cartographic.height.toString() + ","
      console.log(string);
      
  }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
};

export default click;
